package up_down_share.component;

// ----------------------------------------------------------------------------------------------------
// ----- Utility -----
// ----------------------------------------------------------------------------------------------------
public class Utility extends up_down_share.library.Utility
{
	// --------------------------------------------------
	// ----- constants -----
	// --------------------------------------------------
	public static final int UIUPDATE_EXCEPTION = 1001;
	public static final int UIUPDATE_INITVIEW = 1002;
	public static final int UIUPDATE_UPDATEVIEW = 1003;
	public static final int UIUPDATE_CLOSEVIEW = 1004;
	public static final int UIUPDATE_OPENPROGRESSVIEW = 1005;
	public static final int UIUPDATE_CLOSEPROGRESSVIEW = 1006;
	public static final int UIUPDATE_ALERT = 1007;

	// --------------------------------------------------
	// ----- functions -----
	// --------------------------------------------------
	public static String getTimeString(final int milliseconds)
	{
		final int seconds = (milliseconds / 1000) % 60;
		final int minutes = ((milliseconds / 1000) - seconds) % (60 * 60);
		final int hours = ((milliseconds / 1000) - minutes - seconds);
		if (hours > 0)
		{
			return String.format("%02d:%02d:%02d", (hours / 60 / 60), (minutes / 60), seconds);
		}
		else
		{
			return String.format("%02d:%02d", (minutes / 60), seconds);
		}
	}
}
